# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=s2geometry
pkgver=0.9.0
pkgrel=5
pkgdesc="Computational geometry and spatial indexing on the sphere "
url="https://s2geometry.io/"
arch="all"
license="Apache-2.0"
makedepends="
	cmake
	gtest-dev
	openssl1.1-compat-dev
	python3-dev
	swig
	"
source="https://github.com/google/s2geometry/archive/v$pkgver/s2geometry-v$pkgver.tar.gz
	fix-uint-handling.patch
	fix-newer-openssl.patch
	0001-CMake-add-version-information-to-the-library.patch
	"
subpackages="$pkgname-static $pkgname-dev py3-$pkgname:_py3"
options="!check" # No test target available

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DBUILD_SHARED_LIBS=ON \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_EXAMPLES=OFF
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

_py3() {
	pkgdesc="$pkgdesc (Python)"
	depends="python3"

	amove usr/lib/python3*
}

sha512sums="854ec84a54aff036b3092a6233be0f5fc0e4846ac5f882326bbb3f2b9ce88bd5c866a80ae352d8e7d5ae00b9c9a8ab1cff6a95412f990b7bc1fdc5ca3d632b9c  s2geometry-v0.9.0.tar.gz
6d8ad6dbe3ccbfa9ee230aae7738d7dfe990bded7e268e21f710a29e3ce6463d01ca1694373453e3ceac4eb19cd86532729761c93f079db4ddb422b84602188f  fix-uint-handling.patch
a7b79ce8ec0f45cc6e04925d1530c56126de23b168fc6f5bc22905a8af0006a7aab59dbebf194a5e69bbcf6da9168836e4de775d9cea926ff49e9ebf4471693a  fix-newer-openssl.patch
4f8bce3ec21a3be63c47f3fb78d576065085e243bb7522c1349720cd333f010320f98b391a0f8a323607d31a09d3a395b7f7b420638f16eea8deb968d3f2c99c  0001-CMake-add-version-information-to-the-library.patch"
